<?php defined('LG_ADMIN') or die('Access Denied'); ?>
<?php

use h1cms\H1;
use Lg\View\Asset;
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title><?php echo get_option('system.sitename'); ?> - <?php echo get_default(H1::$app->screen->title, '控制面板'); ?></title>


        <link rel="stylesheet" type="text/css" href="<?php echo root_url("/assets/admin-ui/css/font-awesome.min.css"); ?>" />
        <link rel="stylesheet" type="text/css" href="<?php echo root_url("/assets/admin-ui/css/simple-line-icons.css"); ?>" />
        <link rel="stylesheet" type="text/css" href="<?php echo root_url("/assets/admin-ui/css/simple-line-icons.css"); ?>" />
        <link rel="stylesheet" href="<?php echo root_url("/assets/admin-ui/css/style.css"); ?>" />               

        <link href="<?php echo root_url("/assets/flags/flags.css"); ?>" rel="stylesheet">
        <script src="<?php echo root_url('/assets/admin-ui/js/libs/jquery.min.js'); ?>"></script>
        <script src="<?php echo root_url('/assets/admin-ui/js/libs/tether.min.js'); ?>"></script>
        <script src="<?php echo root_url('/assets/admin-ui/js/libs/bootstrap.min.js'); ?>"></script>
        <script src="<?php echo root_url('/assets/admin-ui/js/libs/pace.min.js'); ?>"></script>

        <?php Asset::render(Asset::HEAD); ?>
        <!--[if lt IE 9]>
        <script src="//cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body class="navbar-fixed sidebar-nav fixed-nav">
        <?php Asset::render(Asset::BODY_BEGIN); ?>
        <header class="navbar">
            <div class="container-fluid">
                <button class="navbar-toggler mobile-toggler hidden-lg-up" type="button">&#9776;</button>
                <a class="navbar-brand" href="<?php echo url_for('/dashboard/'); ?>"></a>
                <ul class="nav navbar-nav hidden-md-down">
                    <li class="nav-item">
                        <a class="nav-link navbar-toggler layout-toggler" href="#">☰</a>
                    </li>

                    <li class="nav-item dropdown p-x-1">                        
                        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">
                            新建 
                        </a>                    
                        <div class="dropdown-menu">                        
                            <a class="dropdown-item" href="<?php echo url_for('/node/node.php?action=add') ?>">文章</a>
                            <a class="dropdown-item" href="<?php echo url_for('/node/category.php?action=add') ?>">分类</a>
                            <a class="dropdown-item" href="<?php echo url_for('/users/?action=add') ?>">用户</a>
                        </div>
                    </li>               
                </ul>  

                <ul class="nav navbar-nav pull-right hidden-md-down">
                    <li class="nav-item dropdown hidden-md-down p-r-2">
                        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                            <img src="<?php echo get_avatar(); ?>" class="img-avatar" alt="English" height="24"> <strong><?php echo h1cms\system\Auth::user()->display_name; ?></strong>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right">
                            <div class="dropdown-header text-center">
                                <strong>设置</strong>
                            </div>

                            <a class="dropdown-item" href="<?php echo url_for('/users/?action=profile'); ?>"><i class="fa fa-user"></i> 个人信息</a>                                                                        
                            <a class="dropdown-item" href="<?php echo url_for('/auth/logout.php'); ?>"><i class="fa fa-lock"></i> 退出</a>
                        </div>

                    </li>

                </ul>
            </div>
        </header>
        <?php include 'sidebar.php'; ?>
        <!-- Main content -->
        <main class="main">                
            <!-- Breadcrumb -->
            <ol class="breadcrumb">
                <?php foreach (screen()->breadcrumbs as $breadcrumb) { ?>
                    <li class="breadcrumb-item <?php echo empty($breadcrumb['link']) ? 'active' : ''; ?>">
                        <?php if (empty($breadcrumb['link'])) {
                            echo $breadcrumb['label'];
                        } else { ?>
                            <a href="<?php echo $breadcrumb['link']; ?>" >
                                <i class="<?php echo \Lg\Support\Arr::get($breadcrumb, 'class'); ?>"></i> <?php echo $breadcrumb['label']; ?></a> 
                    <?php } ?>
                    </li>
<?php } ?>
                <li class="breadcrumb-menu">
                    <div class="btn-group" role="group" aria-label="Button group with nested dropdown">
                        <a class="btn btn-secondary" href="http://www.h1cms.com/docs" target="_blank"><i class="icon-question"></i> &nbsp;帮助文档</a>
                    </div>
                </li>
            </ol>
            <div class="container-fluid">

                <?php
                $flash_messages['success'] = Lg\Http\Session::getFlash('success');
                $flash_messages['error'] = Lg\Http\Session::getFlash('error');
                $flash_messages['info'] = Lg\Http\Session::getFlash('info');
                if (!empty($flash_messages['success']) || !empty($flash_messages['success']) && !empty($flash_messages['success'])) {
                    ?>
                    <div class="row">
                        <div class="col-lg-12">
                            <?php
                            foreach ($flash_messages as $flashtype => $messages) {
                                foreach ($messages as $msg) {
                                    ?>
                                    <div class="alert alert-<?php echo $flashtype; ?> alert-dismissible p-b-2" >
                                        <button type = "button" class = "close" data-dismiss = "alert" aria-hidden = "true">×</button>
                                    <?php echo $msg; ?>
                                    </div>                        
                                    <?php
                                }
                            }
                            ?>
                        </div>
                    </div>

<?php } ?>




